import java.util.Scanner;

public class Points {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int [] pointArray = {0,0,0,0,0,0};
        //循环读取6个1-100之间的点
        for (int i = 0; i < 6; ) {
            System.out.print("Enter a point between 1 to 100 :");
            int indexNumber = s.nextInt();
            //判断输入的点是否在1-100之间
            if (indexNumber > 0 && indexNumber <= 100) {
                //循环将输入的点赋值给数组
                for (int j = 0; j < 6; j++) {
                    pointArray[i] = indexNumber;
                }
                i++;
            }else {
                System.out.println("Enter point is error!");
            }
        }
        //循环找出数组中的最大值
        int Max = pointArray[0];
        for (int i = 1; i < pointArray.length; i++) {
            if (Max < pointArray[i]) {
                Max = pointArray[i];
            }

        }
        //循环找出数组中的最小值
        int Min = pointArray[0];
        for (int i = 1; i < pointArray.length; i++) {
            if (Min > pointArray[i]) {
                Min = pointArray[i];

            }

        }
        //计算数组中除最大值和最小值之外的平均值
        int count = 0;
        for (int i = 0; i < pointArray.length; i++) {
            count += pointArray[i];

        }
        int arg = (count - Max - Min) / 4;
        System.out.println("最终得分：" + arg);
    }
}
